#!/bin/bash
set -e
set -x
MYDIR="${0%/*}"
cd "$MYDIR/.."
source "recipes/common.sh"


# RECIPE START cross-pkg-config

save_CFLAGS="$CFLAGS"
save_CPPFLAGS="$CPPFLAGS"
save_LDFLAGS="$LDFLAGS"
export CFLAGS='-O2 -g'
unset CPPFLAGS
unset LDFLAGS

# build a temporary ${TARGET}-targeted native pkg-config 
reset_mtime pkg-config pkg-config/configure.ac
mkdir -p build/pkg-config-cross
cd build/pkg-config-cross
../../pkg-config/configure \
	--host="$BUILD" \
	--build="$BUILD" \
	--prefix="${build_prefix}" \
	--with-internal-glib \
	--disable-host-tool \
	--enable-define-prefix \
	--program-prefix="${TARGET}-" \
	--with-pc-path="${stage}${prefix}/${target_libdir}/pkgconfig"

cd ../..
make_native_build build/pkg-config-cross

export CFLAGS="$save_CFLAGS"
export CPPFLAGS="$save_CPPFLAGS"
export LDFLAGS="$save_LDFLAGS"

# RECIPE END cross-pkg-config
